package api

import (
	"github.com/gin-gonic/gin"
	"golang-websocket-chatroom/api/handler"
	"golang-websocket-chatroom/api/middleware"
	"golang-websocket-chatroom/pkg/jwt"
)

func Router(r *gin.Engine) {
	r.Use(middleware.Use())
	api := r.Group("api")
	{
		user := api.Group("user")
		{
			user.POST("/login", handler.Login)
		}
		room := api.Group("room")
		{
			room.Use(jwt.JWTAuth(handler.JWT_USER_ID))
			room.POST("/roomAdd", handler.RoomAdd)
			room.POST("/roomAddUser", handler.RoomAddUser)
			room.GET("/ws", handler.Chat)
			room.POST("/roomList", handler.RoomList)

		}
	}
}
